package com.woyowodaows.weight;

import android.content.Context;
import android.support.annotation.ColorInt;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.woyowodaows.R;

/**
 * Created by Administrator on 2019/4/3.
 */

public class TextViewWithPoint  extends RelativeLayout {
    private TextView tv_content,tv_notice;
    private Context context;
    public TextViewWithPoint(Context context) {
        super(context);
        this.context=context;
        setupView();
    }

    public TextViewWithPoint(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context=context;
        setupView();
    }


    private void setupView() {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.textview_withpoint, this);
        tv_content= (TextView) findViewById(R.id.tv_content);
        tv_notice= (TextView) findViewById(R.id.tv_notice);
    }

    public void setText(String msg){
        tv_content.setText(msg);
    }

    public void setTextColor(@ColorInt int color) {
        tv_content.setTextColor(color);
    }

    /**
     * @param bol  true==显示红点
     *             false==不显示红点
     */
    public void setRedPoint(boolean bol){
        if(bol){
            tv_notice.setVisibility(VISIBLE);
        }else{
            tv_notice.setVisibility(INVISIBLE);
        }
    }


}
